home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
BUS
/
TMCM Software and Labs.sit
/
Software for TMCM 7_95
/
Files for Lab 13
/
DrawGraphs
< prev
next >
Wrap
Text File
|
1995-07-08
|
1KB
|
55 lines
{
This program draws the graphs of two functions,
y = x^2/8 and y = x^3/64, on the same set of
axes.
Your assignment is to modify the program so that
the two graphs will be drawn simultaneously by two
separate turtles.
}
SUB Axes { Subroutine for drawing the axes }
PenUp
MoveTo(-8,0)
PenDown
MoveTo(8,0)
PenUp
MoveTo(0,-8)
PenDown
MoveTo(0,8)
END SUB
SUB Graph1 { Subroutine for drawing the graph of y = x^2/8 }
DECLARE x,y
PenUp
x := -8
y := x^2 / 8
MoveTo(x,y)
PenDown
LOOP
x := x + 0.5
EXIT IF x > 8
y := x^2 / 8
MoveTo(x,y)
END LOOP
END SUB
SUB Graph2 { Subroutine for drawing the graph of y = x^3/64 }
DECLARE x,y
PenUp
x := -8
y := x^3 / 64
MoveTo(x,y)
PenDown
LOOP
x := x + 0.5
EXIT IF x > 8
y := x^3 / 64
MoveTo(x,y)
END LOOP
END SUB
Axes { Draw the Axes. }
Graph1 { Draw the first graph. }
Graph2 { Then draw the second graph. }
HideTurtle { since the picture looks better without it. }